﻿<phone:PhoneApplicationPage
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:Custom="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" xmlns:GalaSoft_MvvmLight_Command="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP7" xmlns:VSM="clr-namespace:JustinAngel.Neurons.Framework" x:Class="JustinAngel.Neurons.Pages.Splash.SplashPage"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="800" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False"
    VSM:VSM.StateName="{Binding CurrentStateName}"
	 DataContext="{Binding SplashViewModel, Source={StaticResource ViewModelLocator}}" Background="Black"
	>
	<phone:PhoneApplicationPage.Foreground>
		<SolidColorBrush Color="{StaticResource PhoneForegroundColor}"/>
	</phone:PhoneApplicationPage.Foreground>
	<Custom:Interaction.Triggers>
		<Custom:EventTrigger EventName="Loaded">
			<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding Loaded, Mode=OneWay}"/>
		</Custom:EventTrigger>
		<Custom:EventTrigger EventName="MouseLeftButtonDown">
			<GalaSoft_MvvmLight_Command:EventToCommand Command="{Binding OnUserInteractionWithSplashShowLoadingAnimation}"/>
		</Custom:EventTrigger>
	</Custom:Interaction.Triggers>

    <!--LayoutRoot is the root grid where all page content is placed-->
    <Grid x:Name="LayoutRoot" Background="Transparent">
    	<VisualStateManager.VisualStateGroups>
    		<VisualStateGroup x:Name="SplashAnimationStates">
    			<VisualState x:Name="IsSplashPlaying">
    				<Storyboard>
    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="appName">
    						<DiscreteObjectKeyFrame KeyTime="0:0:4.3">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    						<DiscreteObjectKeyFrame KeyTime="0:0:5">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    					<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="appName">
    						<EasingDoubleKeyFrame KeyTime="0:0:4.3" Value="0"/>
    						<EasingDoubleKeyFrame KeyTime="0:0:5" Value="1"/>
    					</DoubleAnimationUsingKeyFrames>
    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="secondaryTitle">
    						<DiscreteObjectKeyFrame KeyTime="0:0:8.3">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    						<DiscreteObjectKeyFrame KeyTime="0:0:9">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    					<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="secondaryTitle">
    						<EasingDoubleKeyFrame KeyTime="0:0:8.3" Value="0"/>
    						<EasingDoubleKeyFrame KeyTime="0:0:9" Value="1"/>
    					</DoubleAnimationUsingKeyFrames>
    				</Storyboard>
    			</VisualState>
    			<VisualState x:Name="NotIsSplashPlaying"/>
    		</VisualStateGroup>
    		<VisualStateGroup x:Name="LoadingStates">
    			<VisualState x:Name="IsLoading">
    				<Storyboard>
    					<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="loadingText">
    						<DiscreteObjectKeyFrame KeyTime="0">
    							<DiscreteObjectKeyFrame.Value>
    								<Visibility>Visible</Visibility>
    							</DiscreteObjectKeyFrame.Value>
    						</DiscreteObjectKeyFrame>
    					</ObjectAnimationUsingKeyFrames>
    					<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="loadingText">
    						<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
    						<EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="1"/>
    					</DoubleAnimationUsingKeyFrames>
    				</Storyboard>
    			</VisualState>
    			<VisualState x:Name="NotIsLoading"/>
    		</VisualStateGroup>
    	</VisualStateManager.VisualStateGroups>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
    	<MediaElement x:Name="mediaElement" Grid.Row="1" Volume="1" RenderTransformOrigin="0.5,0.5" Source="{Binding SplashVideoSource}">
    		<MediaElement.RenderTransform>
    			<CompositeTransform ScaleX="1.75" ScaleY="1.75" Rotation="90"/>
    		</MediaElement.RenderTransform>
    	</MediaElement>
    	<TextBlock x:Name="appName" Grid.Row="1" Style="{StaticResource PhoneTextHugeStyle}" TextWrapping="Wrap" Text="Neurons." VerticalAlignment="Top" Margin="24,74,47,0" FontSize="96" d:LayoutOverrides="HorizontalAlignment" Opacity="0" Foreground="White"/>
    	<TextBlock x:Name="secondaryTitle" Margin="30,202,86,0" Grid.Row="1" Style="{StaticResource PhoneTextLargeStyle}" TextWrapping="Wrap" Text="Use yours." FontFamily="Segoe WP Semibold" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Opacity="0" RenderTransformOrigin="0.5,0.5" d:LayoutOverrides="HorizontalAlignment" VerticalAlignment="Top" Visibility="Collapsed" Foreground="White"/>
    	<TextBlock x:Name="loadingText" HorizontalAlignment="Center" Margin="0,0,0,75" Grid.Row="1" Style="{StaticResource PhoneTextNormalStyle}" TextWrapping="Wrap" Text="Getting New Videos..." VerticalAlignment="Bottom" Visibility="Collapsed" Opacity="0"/>

        <!--TitlePanel contains the name of the application and page title-->

        <!--ContentPanel - place additional content here-->
    </Grid>
 
    <!--Sample code showing usage of ApplicationBar-->
    <!--<phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
            <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
            <shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>-->

</phone:PhoneApplicationPage>
